import javax.swing.*;
import java.security.PublicKey;

public class GraphL {
    //顶点数组
    GraphNode node[];
    //定点数量，边数量
    int nodeNum, edgesNum;


    public static void main(String[] args) {
        GraphL gl = new GraphL();
        gl.initGraph(gl);
        System.out.println(gl.nodeNum);
    }

    public void initGraph(GraphL g) {
        //图的结点与边信息
        Graph gh = new Graph();
        int[][] adjArr = gh.setArray();

        g.node = new GraphNode[adjArr.length];
        g.nodeNum = adjArr.length;
        //结点数组初始化
        for (int i = 0; i < adjArr.length; i++) {

            GraphNode gl = new GraphNode();
            //结点数据
            gl.data = "Tom" + i;
            //结点序号
            gl.adjvex = i;
            g.node[i] = gl;
        }
        //结点邻接边初始化
        for (GraphNode gn : g.node) {
            GraphNode p = gn;
            for (int i = 0; i < g.nodeNum; i++) {
                if (adjArr[gn.adjvex][i] == 1) {
                    GraphNode newnode = new GraphNode();
                    newnode.data = g.node[i].data;
                    newnode.adjvex = i;
                    p.firstedge = newnode;
                    p = p.firstedge;
                }
                p.firstedge = null;
            }

        }
    }
}
